package com.corpgovernment.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

public enum RcTypeEnum {

	A(0, "超标审批"), B(1, "普通审批"), R(2, "改签审批"),
	;

	@Getter
	private Integer code;
	@Getter
	private String desc;

	RcTypeEnum(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	/**
	 * 获取审批类型描述
	 *
	 * @param code
	 * @return
	 */
	public static String getByCode(Integer code) {
		return Arrays.stream(RcTypeEnum.values()).filter(e -> Objects.equals(code, e.getCode())).map(RcTypeEnum::getDesc).findFirst().orElse(null);
	}
}
